package com.dm0858.bianmin.ui.presenter;

import com.dm0858.bianmin.model.response.ArticleDetailResponse;
import com.dm0858.bianmin.model.response.NormalResponse;
import com.dm0858.bianmin.model.response.OtherNewsListResponse;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.view.IArticleDetailView;
import com.dm0858.bianmin.view.INormalListView;
import com.dm0858.bianmin.view.IOtherNewsListView;
import com.socks.library.KLog;

import rx.Subscriber;

/**
 * Created by yelvqing on 2018/5/1.
 */

public class OtherNewsListPresenter  extends BasePresenter<IOtherNewsListView> {

    public OtherNewsListPresenter(IOtherNewsListView view) {
        super(view);
    }

    public void getOtherNewsList(String type) {
        addSubscription(mApiService.getOtherNewsList(type), new Subscriber<OtherNewsListResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

                e.printStackTrace();
                KLog.e(e.getLocalizedMessage());
                mView.onError();
            }

            @Override
            public void onNext(OtherNewsListResponse response) {

                mView.onGetOtherNewsListSuccess(response);
            }

        });
    }
}